"""
@author: Daniel Geymayer, Alexander Fruehwirth, Michael Joergler
@version: 1.0
"""

from django import forms
from django.forms import formsets
from website.models import Recipe, Recipe_Ingredient, Filter, Ingredient_Filter
from django.contrib.auth.models import User

class RegisterMail(forms.ModelForm):
    class Meta:
        model = User
        fields = ('username', 'email', 'password',)
        widgets = {'password': forms.PasswordInput()}      
        
class RecipeForm(forms.ModelForm):
    class Meta:
        model = Recipe
        fields = ('title', 'servings', 'kcal', 'difficulty', 'vegetarian', 'description')

class IngredientInlineFormset(formsets.Form):
    class Meta:
        model = Recipe_Ingredient

class IngredientForm(forms.ModelForm):
    class Meta:
        model = Recipe_Ingredient
        fields = ('name', 'amount', 'unit')
        
class LoginForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('username', 'password')
        widgets = {'password': forms.PasswordInput(),}
        
class UserProfileForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('first_name', 'last_name', 'email', 'username')
        
class UserFilterForm(forms.ModelForm):
    class Meta:
        model = Filter
        fields = ('difficulty', 'vegetarian')
        
class IngredientFilterInlineFormset(formsets.Form):
    class Meta:
        model = Ingredient_Filter
        
class IngredientFilterForm(forms.ModelForm):
    class Meta:
        model = Ingredient_Filter
        fields = ('ingredient', 'exclude')
        
class ChangeProfileForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('first_name', 'last_name', 'email')
